package cqut.wys;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;

import java.io.IOException;
import java.util.concurrent.CountDownLatch;

/**
 * Hello world!
 *
 */
@SpringBootApplication
@ImportResource({"classpath:dubbo-service.xml"})
public class App 
{
    @Bean
    public CountDownLatch closeLath(){
        return new CountDownLatch(1);
    }

    public static void main( String[] args ) throws IOException, InterruptedException {
        ApplicationContext ctx = SpringApplication.run(App.class,args);
        System.out.println( "Hello World!" );

//        System.in.read();   //按任意键退出
        CountDownLatch closeLatch = ctx.getBean(CountDownLatch.class);
        closeLatch.await();
    }
}
